/**
 * 	 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *   @author Colin Redmond
 *   Copyright (C) 2011 Colin Redmond
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

package com.cred.industries.platform.bo;

import java.util.Random;


import com.cred.industries.platform.business.objects.CustomerBO;
import com.cred.industries.platform.trans.CustomerTestTrans;
import com.cred.industries.platform.transferObj.DetailedCustomerTrans;

public class CustomerTestBO {
	
	private CustomerTestTrans mCreateCustTrans = new CustomerTestTrans();
	private String mSessionId = "";

	
	public CustomerTestTrans getCreateCustTrans() {
		return mCreateCustTrans;
	}

	public void setCreateCustTrans(CustomerTestTrans createCustTrans) {
		this.mCreateCustTrans = createCustTrans;
	}
	
	public void setCreateCustTrans(DetailedCustomerTrans createCustTrans) {
		this.mCreateCustTrans = new CustomerTestTrans(createCustTrans.getCustomerId(), createCustTrans.getPersonaName()
				, createCustTrans.getPassword(), createCustTrans.getFirstName(), createCustTrans.getLastName(), createCustTrans.getEmailAddress());
	}
	
	
	
	public String getSessionId() {
		return mSessionId;
	}

	public void setSessionId(String sessionId) {
		this.mSessionId = sessionId; 
	}
	
	public void CreateRandom() {
		
		Random rand = new Random();
		int randomNum = rand.nextInt(99999);
		//create a new customer
		CustomerTestTrans createCustTrans = new CustomerTestTrans();
		createCustTrans.customerId = 0;
		createCustTrans.personaName = "persona" + randomNum;
		createCustTrans.emailAddress = "email" + randomNum + "@home.com";
		createCustTrans.firstName = "first" + randomNum;
		createCustTrans.lastName = "last" + randomNum;
		createCustTrans.password = "pass" + randomNum;
		
		mCreateCustTrans = createCustTrans;
	}
	
	public CustomerBO getCustomerBO() {
		
		CustomerBO custBO = new CustomerBO(mCreateCustTrans.customerId
				, mCreateCustTrans.personaName
				, mCreateCustTrans.emailAddress
				, mCreateCustTrans.firstName
				, mCreateCustTrans.lastName
				, mCreateCustTrans.emailAddress);
		
		return custBO;
	}


}
